<!DOCTYPE html>
<html  lang="en"  xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Thymeleaf 语法</title>
    <style type="text/css">
        .div1{
            border: 1px red solid;
        }
        .div2{
            border: 1px black solid;
        }
    </style>
</head>
<body>
    <!--th:each 遍历列表，常用，优先级很高，仅此于代码块的插入-->
    <b th:text="${lists}"></b>
    <table>
        <tr>
            <th>序号</th>
            <th>姓名</th>
            <th>年龄</th>
        </tr>
        <tr th:each="student, ind:${lists}">
            <td th:text="${ind.count}"></td>
            <td th:text="${student.name}"></td>
            <td th:text="${student.age}"></td>
        </tr>
    </table>

    <!--th:each 遍历列表，常用，优先级很高，仅此于代码块的插入-->
    <!-- 遍历整个div-p，不推荐-->
    <div class="div1" th:each="msg:${list}">
        <span th:text="${msg}"></span>
    </div>
    <!--th:each 修饰在div上，则div层重复出现，若只想p标签遍历，则修饰在p标签上-->
    <!--只遍历p，推荐使用-->
    <div class="div2">
        <span th:each="val:${list}" th:text="${val}"></span>
    </div>
</body>
</html>